
/*
 * DirectionMachine.java
 *
 * Created on 04-Mar-2009, 19:39:38
 */

package camp.junk;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.swing.border.LineBorder;
import straightskeleton.Machine;
import straightskeleton.ui.DirectionEvent;
import straightskeleton.ui.MachineEvent;

/**
 *
 * @author twak
 */
public class DirectionUI extends javax.swing.JPanel {

    List<MachineEvent> dirs = new ArrayList();

    /** Creates new form DirectionMachine */
    public DirectionUI() {
        initComponents();
    }

    public DirectionUI (Machine machine)
    {
//        dirs = machine.directions;
        initComponents();
    }

    public DirectionUI( Machine aThis, Color color )
    {
        this (aThis);
//        jDirectionRack1.setBorder( new LineBorder( color.darker(),4 ));
//        jDirectionRack1.setBackground( color.brighter().brighter().brighter() );
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        addDirection = new javax.swing.JButton();
        addWindowButton = new javax.swing.JButton();
        removeDirection = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jPanel1.setLayout(new java.awt.GridLayout(1, 0));

        addDirection.setText("+");
        addDirection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addDirectionActionPerformed(evt);
            }
        });
        jPanel1.add(addDirection);

        addWindowButton.setText("W");
        addWindowButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addWindowButtonActionPerformed(evt);
            }
        });
        jPanel1.add(addWindowButton);

        removeDirection.setText("-");
        removeDirection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeDirectionActionPerformed(evt);
            }
        });
        jPanel1.add(removeDirection);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(268, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void addDirectionActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addDirectionActionPerformed
    {//GEN-HEADEREND:event_addDirectionActionPerformed
//        jDirectionRack1.addDirection(new DirectionEvent (Math.PI/4, 0));
}//GEN-LAST:event_addDirectionActionPerformed

    private void removeDirectionActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_removeDirectionActionPerformed
    {//GEN-HEADEREND:event_removeDirectionActionPerformed
//        jDirectionRack1.removeSelectedDirection();
}//GEN-LAST:event_removeDirectionActionPerformed

    private void addWindowButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addWindowButtonActionPerformed
    {//GEN-HEADEREND:event_addWindowButtonActionPerformed
//        jDirectionRack1.addDirection( new WindowEvent( 0 ) );
}//GEN-LAST:event_addWindowButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addDirection;
    private javax.swing.JButton addWindowButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton removeDirection;
    // End of variables declaration//GEN-END:variables

}
